# Contributor: Jo Coscia <jo@jcoscia.com>
# Maintainer: Jo Coscia <jo@jcoscia.com>
pkgname=lkrg
pkgver=0.9.6
pkgrel=0
pkgdesc="Linux Kernel Runtime Guard kernel module (AKMS)"
url="https://lkrg.org/"
arch="x86 x86_64 aarch64 armhf armv7"
license="GPL-2.0-only"
depends="akms"
install="$pkgname.post-deinstall"
subpackages="$pkgname-doc"
source="https://lkrg.org/download/lkrg-$pkgver.tar.gz
	AKMBUILD"
options="!check"  # no test suite

package() {
	install -Dm644 "$srcdir"/AKMBUILD "$pkgdir"/usr/src/lkrg/AKMBUILD
	install -Dm644 "$builddir"/Makefile "$pkgdir"/usr/src/lkrg/Makefile
	install -Dm644 "$builddir"/scripts/bootup/lkrg.conf "$pkgdir"/etc/sysctl.d/lkrg.conf
	install -Dm644 "$builddir"/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
	cp -Rp "$builddir"/src "$pkgdir"/usr/src/lkrg/src
	chmod -R u=rwX,go=rX-w "$pkgdir"/usr/src/lkrg/
}

doc() {
	pkgdesc="Documentation for $pkgname"
	mkdir -p "$subpkgdir"/usr/share/doc/"$pkgname"
	mv "$builddir"/CHANGES "$subpkgdir"/usr/share/doc/lkrg/
	mv "$builddir"/CONCEPTS "$subpkgdir"/usr/share/doc/lkrg/
	mv "$builddir"/PATREONS "$subpkgdir"/usr/share/doc/lkrg/
	mv "$builddir"/PERFORMANCE "$subpkgdir"/usr/share/doc/lkrg/
	mv "$builddir"/README "$subpkgdir"/usr/share/doc/lkrg/
	chmod -R u=rwX,go=rX-w "$subpkgdir"/usr/share/doc/lkrg/
}

sha512sums="
08c109ffbe7f15ff60ed1958640f43194b96b16c75bd91c1e209e2f93a2b97f60f0b9ed00ccc13effbbf06092fc3c432dfb55f94b9e181a6cd2b30a1ea8ee653  lkrg-0.9.6.tar.gz
e9174654cac18a8cbb4dc8e46a93bd19620ab355bf50563660980a525e87eb1d72b9fdece9fac5749c8ffad7ea38940da8e5bd950439695e2f50d82eebd18b5c  AKMBUILD"
